package core.testcases;

import java.util.ArrayList;

/**
 * Description : Functional Test Script
 * 
 * @author angel.tsvetkov
 */
public class TestCase {
	// Test Case ID
	private String testCaseID;

	// Test Case Description
	private String testCaseDescription;

	// Covered Requirements
	private String coveredRequirement;

	// Created By
	private String createdBy;

	// Executed By
	private String performedBy;

	// Covered Defects
	private String coveredDefect;

	// Additional comments
	private String testCaseComment;

	// Boolean representation of test case result
	private boolean result;

	// Test Case brief description
	private String briefDescription;

	// Test Case Report URL
	private String testCaseURL;

	// List of test steps
	public ArrayList<TestStep> testSteps;

	// List of preconditions
	public ArrayList<String> preconditions;

	// Copy constructor
	@SuppressWarnings("unchecked")
	public TestCase(TestCase testCase) {
		this.testCaseID = testCase.testCaseID;
		this.testCaseDescription = testCase.testCaseDescription;
		this.coveredRequirement = testCase.coveredRequirement;
		this.createdBy = testCase.createdBy;
		this.performedBy = testCase.performedBy;
		this.coveredDefect = testCase.coveredDefect;
		this.testCaseComment = testCase.testCaseComment;
		this.result = testCase.result;
		this.briefDescription = testCase.briefDescription;
		this.testCaseURL = testCase.testCaseURL;
		this.testSteps = (ArrayList<TestStep>) testCase.testSteps.clone();
		this.preconditions = (ArrayList<String>) testCase.preconditions.clone();
	}

	// Getters and Setters//////////////////
	public int getStepsCount() {
		return testSteps.size();
	}

	public TestCase() {
		testSteps = new ArrayList<TestStep>();
		preconditions = new ArrayList<String>();
	}

	public void addTestStep(TestStep testStep) {
		testSteps.add(testStep);
	}

	public void setTestCaseID(String testCaseID) {
		this.testCaseID = testCaseID;
	}

	public String getTestCaseID() {
		return testCaseID;
	}

	public void setTestCaseDescription(String testCaseDescription) {
		this.testCaseDescription = testCaseDescription;
	}

	public String getTestCaseDescription() {
		return testCaseDescription;
	}

	public void setCoveredRequirement(String coveredRequirement) {
		this.coveredRequirement = coveredRequirement;
	}

	public String getCoveredRequirement() {
		return coveredRequirement;
	}

	public void setCreatedBy(String createdBy) {
		this.createdBy = createdBy;
	}

	public String getCreatedBy() {
		return createdBy;
	}

	public void setPerformedBy(String performedBy) {
		this.performedBy = performedBy;
	}

	public String getPerformedBy() {
		return performedBy;
	}

	public void setCoveredDefect(String coveredDefect) {
		this.coveredDefect = coveredDefect;
	}

	public String getCoveredDefect() {
		return coveredDefect;
	}

	public void setTestCaseComment(String testCaseComment) {
		this.testCaseComment = testCaseComment;
	}

	public String getTestCaseComment() {
		return testCaseComment;
	}

	public void setResult(boolean result) {
		this.result = result;
	}

	public boolean isResult() {
		return result;
	}

	public void setBriefDescription(String briefDescription) {
		this.briefDescription = briefDescription;
	}

	public String getBriefDescription() {
		return briefDescription;
	}

	public void setTestCaseURL(String testCaseURL) {
		this.testCaseURL = testCaseURL;
	}

	public String getTestCaseURL() {
		return testCaseURL;
	}

	// //////////////////////////////////////////////////////

	// Set default values to all variables
	public void clear() {
		testCaseID = null;
		testCaseDescription = null;
		coveredRequirement = null;
		createdBy = null;
		performedBy = null;
		coveredDefect = null;
		testCaseComment = null;
		testSteps.clear();
	}
}
